'use strict';
var Schema = require('mongoose').Schema,
    Model = require('../../../Base/server/controllers/Model');

var modelField = {};

modelField.ItemMaster = {
    type: Schema.ObjectId,
    ref: 'ItemMaster',
    Name: '物料'
};

modelField.ItemCategory = {
    type: Number,
    Name: '料品分类'
};

modelField.Work = {
    type: Schema.ObjectId,
    ref: 'Work',
    Name: '标准作业'
};

modelField.QCNorm = {
    type: Schema.ObjectId,
    ref: 'QCNorm',
    Name: '质检指标'
};

modelField.StandardValue = {
    type: String,
    trim: true,
    Name: '标准值'
};

modelField.ValueUpperLimit = {
    type: Number,
    trim: true,
    Name: '标准值上限'
};

modelField.ValueLowerLimit = {
    type: Number,
    trim: true,
    Name: '标准值下限'
};

modelField.DescSeg1 = {
    type: String,
    default: '',
    trim: true,
    Name: '扩展字段1'
};

var newModel = new Model(modelField);
newModel.addIndex({ItemMaster: 1, Work: 1, QCNorm: 1, ItemCategory: 1, DescSeg1: 1}, {"unique": true});
newModel.create('QCStandard', '质检指标');
